package com.jiyun.controller;

import com.jiyun.pojo.Order;
import com.jiyun.service.OrderSerevice;
import com.jiyun.vo.R;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("order")
@CrossOrigin
public class OrderController {
    @Resource
    private OrderSerevice orderSerevice;

    @RequestMapping("list")
    public R list(Integer current, Integer pageSize) {
        return R.success(orderSerevice.list(current, pageSize));
    }

    @RequestMapping("add")
    public R add(@RequestBody Order order) {
        return R.success(orderSerevice.add(order));
    }

    @RequestMapping("blur")
    public R blur(String htbh) {
        Order blur = orderSerevice.blur(htbh);
        if (blur == null){
            return R.success("没有重复");
        }else{
            return R.error("重复");
        }
    }

}
